import http from '@/utils/http'

const BASE_URL = '/system/classroom'

export interface ClassroomResp {
  id: string | number
  campusId: string
  campusName: string
  name: string
  capacity: string
  area: string
  remark: string
}

export interface ClassroomDetailResp extends ClassroomResp {

}

export interface ClassroomQuery extends SortQuery {
  campusId?: string
  name?: string
}

export interface ClassroomPageQuery extends ClassroomQuery, PageQuery {

}

/** @desc 查询教室列表 */
export function getList(query: ClassroomQuery) {
  return http.get<ClassroomResp[]>(`${BASE_URL}/list`, query)
}

/** @desc 查询教室列表 */
export function getPage(query: ClassroomPageQuery) {
  return http.get<Page<ClassroomResp[]>>(`${BASE_URL}/page`, query)
}

/** @desc 查询教室详情 */
export function getDetail(id: string) {
  return http.get<ClassroomDetailResp>(`${BASE_URL}/detail/${id}`)
}

/** @desc 创建教室 */
export function create(data: any) {
  return http.post(`${BASE_URL}/create`, data)
}

/** @desc 修改教室 */
export function update(data: any, id: string) {
  return http.post(`${BASE_URL}/update/${id}`, data)
}

/** @desc 删除教室 */
export function remove(id: string) {
  return http.post(`${BASE_URL}/delete/${id}`)
}
